<?php

class Myzen_View_Helper_StatusFormatter extends Zend_View_Helper_Abstract {
    
    public function statusFormatter($status) {
    	
    	//we automatically linkify the links
    	$status = preg_replace('/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[A-Z0-9+&@#\/%=~_|]/i', '<a href="\0">\0</a>', $status);
		
		//we automate the link to the user page in format @user
		$status = preg_replace('/@([a-zA-z0-9\._\-]+)/i', '<a href="'.$this->view->baseURL().'/status/user/\1/">\0</a>', $status);

		//we automate the link to the tag in format #tag
		$status = preg_replace('/#([a-zA-z0-9_]+)/i', '<a href="'.$this->view->baseURL().'/status/tag/\1/">\0</a>', $status);

    	return $status;
		
    } //end statusFormatter
} //end class